package com.dazhewan.project.properties;

import java.util.LinkedList;

/**
 * @author: zheng
 * @code date: 2022/10/11
 * @code className: ScreenInfoCache
 * @code description: 缓存最近的截图信息
 */
public class ScreenInfoCache {
    private static final LinkedList<CutScreenInfo> cacheScreenInfo = new LinkedList();
    private static ScreenInfoCache screenInfoCache = new ScreenInfoCache();

    private ScreenInfoCache() {
    }

    public static ScreenInfoCache init() {
        return screenInfoCache;
    }

    public boolean isEmpty(){
        return cacheScreenInfo.size()==0;
    }
    public void addScreenInfo(CutScreenInfo cutScreenInfo) {
        if (cacheScreenInfo.size() == GlobalSettting.SCREEN_CACHE_NUM) {
            cacheScreenInfo.removeFirst();
        }
        cacheScreenInfo.addLast(cutScreenInfo);
    }

    public CutScreenInfo getCutScreenInfo() {
        return cacheScreenInfo.getLast();
    }
}
